import time
def merging(q):  
    for i in range(len(q)-1):
        for j in range (i + 1, len(q)):
            if a[i] >= a[j]:
                t = q[j]
                q[j] = q[i]
                q[i] = t

w = 'm1_sorted (2).txt'
e = 'm2_reverse.txt'
r = "m3_shuffle.txt"
a=[int(i) for i in open('m1_sorted (2).txt')]
b=[int(i) for i in open('m2_reverse.txt')]
c=[int(i) for i in open("m3_shuffle.txt")]
def tim (n,y):
    t_start = time.time()
    merging(n)
    t_finish = time.time()
    print(y, round((t_finish-t_start)*1000), "milliseconds")
tim(a,w)
tim(b,e)
tim(c,r)
